<cffunction name="cssinc" output="false">
<cfhtmlhead text='<link rel="stylesheet" href="/include/infobase.css" type="text/css">'>
</cffunction>

<cffunction name="ViewAsTable" output=True>
   <cfargument name="daQry" type="query" required="true">
   <cfargument name="noShow" type="string" required="false" default="string">
   <cfargument name="linkList" type="string" required="false" default="string">
   <cfset request.dateMask = "mm/dd/yyyy">
   <cfset request.daCols = daQry.columnlist>
   <table>
	 <tr>
	 <cfloop list="#request.daCols#" index="ff">
	   <cfif NOT listFindNoCase(noShow,ff)>
		  <td>#ff#</td>
	   </cfif>
	 </cfloop>
	 </tr>
	 <cfloop query="daQry">
		 <tr>
		 <cfloop list="#request.daCols#" index="ff">
		   <cfset request.fValue = evaluate('daQry.' & ff & '[daQry.currentrow]')>
		   <cfif isDate(request.fValue)>
		     <cfset request.fValue = dateformat(request.fValue,request.dateMask)>
		   </cfif>
			 <cfif NOT listFindNoCase(noShow,ff)>
			   <cfif listFindNoCase(linkList,ff)>
				   <cfset request.lnkURL = 
					   '#listGetAt(linkList,listFindNoCase(linkList,ff)+1)#?#listGetAt(linkList,listFindNoCase(linkList,ff)+2)#=#evaluate('daQry.'&listGetAt(linkList,listFindNoCase(linkList,ff)+2)&'[#daQry.currentrow#]')#'>
				   <td><a href="#request.lnkURL#">#request.fValue#</a></td>
				 <cfelse>
				   <td>#request.fValue#</td>
				 </cfif>
			 </cfif>
		 </cfloop>
		 </tr>	 
	 </cfloop>
	 </table>
</cffunction>


<cffunction name="sideSubList" output="true">
<cfargument name="programID" required="yes" type="numeric">
	<cfquery name="getSubprograms" datasource="#request.dsource#">
	SELECT * FROM subprogram, programSubprograms
	WHERE programSubprograms.programID = #programID# AND subprogram.subprogramID = programSubprograms.subprogramID
	AND subprogram.live = 1 AND subprogram.semesterID = '#request.user.semesterID#'
	ORDER BY name
	</cfquery>	
	<table width="155" border="0" cellspacing="2" cellpadding="2" align="right" title="Course Menu">
	<cfoutput query="getSubprograms">
	<tr>
	<td bgcolor="##333399"><a href="index.cfm?subprogramID=#subprogramID#" class="Nav" >#name#</a></td>
	</tr>
	<tr> 	
	<td height="3"></td>
	</tr>
	</cfoutput>	
	</table>
</cffunction>

<cffunction name="renderAsForm" output="true">
  <cfargument name="formQry" type="query" required="yes">
  <cfargument name="formQryTable" type="string" required="yes">
  <cfargument name="hiddenFields" type="string" required="no" default="" hint="hidden field list">
  <cfargument name="colAlias" type="string" default="" required="no" hint="column alias list">
  <cfset metadata = formQry.getMetaData()>
	<cfobject name="jscal" component="/srvinc/jscalendar">
	<table>
		
	<cfloop list="#arrayToList(metadata.getColumnLabels())#" index="dd">
 	  <tr>
		<cfset request.curDataType = formQry.getColumnTypeName(metadata.getColumnType(formQry.findColumn(dd)))>
	  <cfif isDefined('url.'&dd)>
		 <input type="hidden" name="#dd#" value="#val(formQry[dd][1])#">
		<cfelseif ucase(right(dd,3)) neq ucase('_ID') AND listFindNoCase(formQry.columnlist,dd) AND NOT listFind(hiddenFields,dd)>
	   <td valign="top"><cfif listFindNoCase(colAlias,dd,':')>#listGetAt(colAlias,listFindNoCase(colAlias,dd,':')+1,':')#<cfelse>#rereplace(dd,'_',' ','all')#</cfif></td> 
		 <td>
		 <!---#request.curdatatype# --->
			<cfif findNoCase('text',request.curDataType) OR findNoCase('long',request.curDataType)>
		   <textarea name="#dd#" cols="50" rows="10">#htmlEditFormat(formQry[dd][1])#</textarea>
		  <cfelseif findNoCase('char',request.curDataType)>
		   <input type="text" name="#dd#" value="#formQry[dd][1]#">
			<cfelseif findNoCase('date',request.curDataType) OR findNoCase('timestamp',request.curDataType)>
		    <input type="text" name="#dd#" id="#dd#" size="10" value="#dateformat(formQry[dd][1],'mm/dd/yy')#">
				#jscal.linkfield(dd)#
			<cfelseif findNoCase('double',request.curDataType)>
		   <input type="text" name="#dd#" size="5" value="#numberformat(formQry[dd][1],'__.__')#">
			</cfif>
		 </td>
		<cfelseif listFindNoCase(hiddenFields,dd)>
		 <input type="hidden" name="#dd#" value="#formQry[dd][1]#">
		</cfif>
		</tr>
	 </cfloop>
	 </table>
</cffunction>

<cfscript>
/**
 * Converts a query object into an array of structures.
 * 
 * @param query 	 The query to be transformed 
 * @return This function returns a structure. 
 * @author Nathan Dintenfass (nathan@changemedia.com) 
 * @version 1, September 27, 2001 
 */
function QueryToArrayOfStructures(theQuery){
	var theArray = arraynew(1);
	var cols = ListtoArray(theQuery.columnlist);
	var row = 1;
	var thisRow = "";
	var col = 1;
	for(row = 1; row LTE theQuery.recordcount; row = row + 1){
		thisRow = structnew();
		for(col = 1; col LTE arraylen(cols); col = col + 1){
			thisRow[cols[col]] = theQuery[cols[col]][row];
		}
		arrayAppend(theArray,duplicate(thisRow));
	}
	return(theArray);
}
</cfscript>

<cffunction name="daTable" output="true">
  <cfargument name="daQry" type="query" required="true">
  <cfargument name="linkList" type="string" default="">
  <cfargument name="noShowList" type="string" default="">
  <cfargument name="border" type="string" default="0">
  <cfargument name="altRowColor" type="string" default="">
  <cfargument name="width" type="string" default="">
  <cfargument name="colNameStyle" type="string" default="text-transform: capitalize;">
  <cfargument name="cellAlign" type="string" default="">
  <cfargument name="cellvalign" type="string" default="top">
  <cfargument name="cellpadding" type="string" default="1">
  <cfargument name="cellspacing" type="string" default="0">
  <cfargument name="excelfile" type="string" default="">
	<cfargument name="MaxRows" type="numeric" default="20">
	<cfparam name="StartRow" default="1">
	<cflock scope="session" timeout="10" type="exclusive">
		<cfparam name="session.daDateMask" default="mm/dd/yy">
		<cfset session.daDateMask = session.daDateMask>
	</cflock>
	<cfwddx action = "cfml2wddx" input = #daQry# output = "wddxText">	
	<cfset daXML = xmlParse(wddxText)>
	<cfset daFlist = daXML.wddxPacket.data.recordset.XmlAttributes.fieldNames>
	<cfloop from="1" to="#daQry.recordcount#" index="ii">
	  <cfloop list="#daQry.columnlist#" index="cn">
			<cfif daQry["#cn#"][ii].toString() is ''><cfset daQry["#cn#"][ii] = ""></cfif>
		</cfloop>
	</cfloop>
  <cfset metadata = daQry.getMetaData()>
	<cfif isDefined('url.searchFor')>
		<cfset ii = 0>
		<cfquery name="daQryOut" dbtype="query">
		 SELECT * FROM daQry
		 WHERE 1!=1 <cfloop list="#url.searchFor#" index="sf"><cfloop list="#url.srhflds#" index="ff"> 
		 
			 <cfif daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#ff#'))) eq 'DOUBLE' OR
			  daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#ff#'))) eq 'INTEGER' OR
				daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#ff#'))) eq 'REAL'>
				 <cfif isNumeric(ff)>
				   OR [#ff#] IN (#val(sf)#)
				 </cfif>
			 <cfelseif daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#ff#'))) eq 'DATE' OR
			  daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#ff#'))) eq 'DATETIME' OR
			  daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#ff#'))) eq 'TIMESTAMP'>
				   <cfif isDate(sf)>OR [#ff#] = '#dateformat(sf,'mm/dd/yy')#'</cfif>
			 <cfelse>
				 OR CAST(UPPER([#ff#]) as VARCHAR) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#ucase(sf)#%">
			 </cfif>
		  </cfloop>
		 </cfloop>
		  <cfif isDefined('url.tabO')>ORDER BY #listFindNoCase(daFlist,listFirst(urldecode(url.tabO),' '))#
		   <cfif listLast(urldecode(url.tabO),' ') eq 'desc'>DESC</cfif>
			</cfif>
		</cfquery>
	<cfelse>
		<cfquery name="daQryOut" dbtype="query">
		 SELECT * FROM daQry
		 <cfif isDefined('url.tabO')>ORDER BY #listFindNoCase(daFlist,listFirst(urldecode(url.tabO),' '))#
		   <cfif listLast(urldecode(url.tabO),' ') eq 'desc'>DESC</cfif></cfif>
		</cfquery>
	</cfif>
	<cfif isDefined('url.dwnldXLS')>
		<cfset daXLS = ''>
		<cfset TabChar = Chr(9)>
		<cfset NewLine = Chr(13) & Chr(10)>
		<cfloop list="#daFlist#" index="field">
		 <cfif NOT listFindNoCase(noShowList,field)>
			<cfset daXLS = daXLS & '#toString(field)##tabChar#'>
		 </cfif>
		</cfloop>
		<cfset daXLS = daXLS & '#NewLine#'>
			<cfloop query="daQryOut">
			 <cfloop list="#daFlist#" index="field">
				 <cfif NOT listFindNoCase(noShowList,field)>
					<cfset request.fValue = evaluate("daQryOut['" & field & "'][daQryOut.currentrow]")>
					<cfset daXLS = daXLS & '#toString(request.fValue)##tabChar#'>
				 </cfif>
			 </cfloop>
			 <cfset daXLS = daXLS & '#NewLine#'>
			</cfloop>
			<cfsetting showdebugoutput="no">
			<cfheader name="Content-Disposition" value="attachment;filename=#excelfile#">
			<cfcontent type="application/msexcel">#daXLS#<cfabort>
	</cfif>

  <cfset request.noShow = 0>
	<style type="text/css">
	<!--
	.toglable {
	}
	 .disLnk {font-size:20px; font-style:normal; text-decoration:none; font-weight:600}
	-->
	</style>
	<script language="javascript">
		function toggleSub() {
			if (document.getElementById('toglable').style.display == 'none') {
					document.getElementById('toglable').style.display = '';
          document.getElementById('searchFor').focus();
				} 
				<cfif NOT isDefined('url.searchFor')>else { document.getElementById('toglable').style.display = 'none';
				}
				</cfif>
			}
	</script>
	<cfset visibleCols = "">
	<cfloop list="#daFlist#" index="cc">
		<cfloop list="#linkList#" index="LL">
			<cfloop from="1" to="#ListLen(listGetAt(LL,2,':'),'&')#" index="lf">
				<cfset noShowList = listAppend(noShowList,listGetAt(ListGetAt(LL,2,":"),lf,"&"))>
			</cfloop>
		</cfloop>
		<cfif NOT listFindNoCase(noShowList,cc)>
			<cfset visibleCols =  listAppend(visibleCols,cc)>
		</cfif>
	</cfloop>
	

<table cellpadding="#cellpadding#" cellspacing="#cellspacing#" width="#width#">
<tr><td align="right" valign="middle">
<cfif excelfile gt "">
	<font size="-1"><a href="#cgi.SCRIPT_NAME#?#cgi.QUERY_STRING#&dwnldXLS=1"><img border="0" src="/infobase/clipart/xls.gif" align="middle"></a>
</cfif>
<cfif isDefined('url.searchFor')>Containing 
<i><cfloop list="#url.searchFor#" index="sf"><a href="#cgi.SCRIPT_NAME#?#rereplace(cgi.QUERY_STRING,'searchFor='&sf,'','all')#"><font color="##FF0000"><b>x</b></font>#sf#</a> </cfloop></i></cfif>
&nbsp;<img src="/Images/magGlassLittle.gif" align="middle" onClick="javascript:toggleSub();">
&nbsp;#startrow# - #min(evaluate(startrow+maxrows),daQryOut.recordcount)# of #daQryOut.recordcount# Records
<cfif (startrow - maxrows) gt 0 >
 <a href="#cgi.SCRIPT_NAME#?startrow=1&#rereplace(cgi.QUERY_STRING,'startrow=[^&]*&','','all')#" class="disLnk">
 &laquo;</a>
 <a href="#cgi.SCRIPT_NAME#?startrow=#Evaluate(StartRow - MaxRows)#&#rereplace(cgi.QUERY_STRING,'startrow=[^&]*&','','all')#" class="disLnk">
 &lsaquo;</a>
</cfif>
<cfif daQryOut.recordcount gt maxrows>
 <cfset daCnt = 1>
 <cfloop from="1" to="#daQryOut.recordcount#" index=i step="#maxrows#">
	<cfif i lt evaluate(startrow + (maxrows*3)) AND i gt evaluate(startrow - (maxrows*3))>
	<a href="#cgi.SCRIPT_NAME#?startrow=#i#&#rereplace(cgi.QUERY_STRING,'startrow=[^&]*&','','all')#">#daCnt#</a>
  </cfif>
  <cfset daCnt = (daCnt + 1)>
 </cfloop>
</cfif>
<cfif (startrow + maxrows) lte daQryOut.recordcount>
 <a href="#cgi.SCRIPT_NAME#?startrow=#Evaluate(StartRow + MaxRows)#&#rereplace(cgi.QUERY_STRING,'startrow=[^&]*&','','all')#" class="disLnk">
 &rsaquo;</a>
 <a href="#cgi.SCRIPT_NAME#?startrow=#daQryOut.recordcount - maxrows#&#rereplace(cgi.QUERY_STRING,'startrow=[^&]*&','','all')#" class="disLnk">
 &raquo;</a>
</cfif>
</font>
</td></tr>
<!--- Get rid of any prior search strings --->
<cfset daUrlVars = cgi.QUERY_STRING>
<cfif listFindNoCase(cgi.QUERY_STRING, 'srhflds',"&=")>
	<cftry>
		<cfset daUrlVars = listDeleteAt(daUrlVars, listContainsNoCase(daUrlVars, 'searchfor=',"&"),"&")>
	<cfcatch >
	</cfcatch>
	</cftry>
	<cfloop condition="listFindNoCase(daUrlVars, 'srhflds=','&')">
	<cfset daUrlVars = listDeleteAt(daUrlVars, listFindNoCase(daUrlVars, 'srhflds=',"&"),"&")>
	</cfloop>
</cfif>

<cfset disPage = cgi.SCRIPT_NAME & '?' & daUrlVars>
<script language="javascript">
    function performSearch() {
      document.location = '#disPage#&srhflds=#visibleCols#&searchFor='+document.getElementById('searchFor').value;
    }
    

function getKey(keyStroke) {
   var keyCode = (document.layers) ? keyStroke.which : event.keyCode;
   var keyString = String.fromCharCode(keyCode).toLowerCase();
}
    function checkKey(keyStroke) {
   var keyCode = (document.all) ? event.keyCode : keyStroke.which;
   var keyString = String.fromCharCode(keyCode).toLowerCase();
	    if (keyCode == 13) {
	    performSearch();
	    return false;
	    } else {return true}
    }

</script>
<tr id="toglable"<cfif NOT isDefined('url.searchFor')> style="display:none"</cfif>><td class="toglable">Search for <input type="text" name="searchFor" id="searchFor">
<script language="javascript">
	document.getElementById('searchFor').onkeypress = checkKey;
	document.getElementById('searchFor').onkeyup = checkKey;
	document.getElementById('searchFor').onkeydown = checkKey;
</script>
<input type="button" value="search" onclick="performSearch()"></td></tr>
</table>
   <table border="#border#" width="#width#" cellpadding="#cellpadding#" cellspacing="#cellspacing#">
	 <tr<cfif altRowColor gt ''> bgcolor="#altRowColor#"</cfif>>
	 <cfloop list="#visibleCols#" index="cc">
      <cfif isDefined('url.tabO') and url.tabO eq cc><cfset request.tabO = cc & ' desc'><cfelse><cfset request.tabO = cc></cfif>
		  <td style="#colNameStyle#" align="#cellalign#">#rereplace(daQryOut['#cc#'][0],'\$','','all')#<a href="#cgi.SCRIPT_NAME#?tabO=#request.tabO#&#rereplace(cgi.QUERY_STRING,'tabO=[^&]*&','','all')#"><strong>#lcase(cc)#</strong><img src="/srvinc/denclude/sort.gif" border="0"></a></td>
	 </cfloop>
	 </tr>
	 <cfloop query="daQryOut" startrow="#StartRow#" endrow="#Evaluate(StartRow + MaxRows)#">
		 <tr<cfif altRowColor gt '' AND NOT (currentrow mod 2)> bgcolor="#altRowColor#"</cfif>>
		 <cfloop list="#daFlist#" index="field">
		   <cfset request.fValue = evaluate("daQryOut['" & field & "'][daQryOut.currentrow]")>
			 <cfif listFindNoCase(noShowList,field)><cfset request.noShow = 1></cfif>
			 <cfif daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#field#'))) eq 'DATE' OR
			  daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#field#'))) eq 'DATETIME' OR
			  daQry.getColumnTypeName(metadata.getColumnType(daQry.findColumn('#field#'))) eq 'TIMESTAMP'>
				  <cfset request.fValue = dateformat(request.fValue,session.daDateMask)>
	     </cfif> 
			   <cfloop list="#linkList#" index="LL">
				   <cfif listFirst(LL,':') eq field>
					   <cfset request.lnkURL = "#listGetAt(LL,3,':')#?">
						 <cfloop from="1" to="#ListLen(listGetAt(LL,2,':'),'&')#" index="lf">
							 <cfset request.lnkURL = request.lnkURL & "#listGetAt(ListGetAt(LL,2,":"),lf,"&")#=" & daQryOut['#listGetAt(ListGetAt(LL,2,":"),lf,"&")#'][daQryOut.currentrow] & "&">
						 </cfloop>
					 </cfif>
					 <cfif listGetAt(LL,2,':') eq field><cfset request.noShow = 1></cfif>
				 </cfloop>
				 <cfif isDefined('request.lnkURL') AND request.lnkURL gt ''>
				   <td align="#cellalign#" valign="#cellvalign#"><a href="#request.lnkURL#">#request.fValue#</a></td>
					 <cfset request.lnkURL = ''>
				 <cfelseif request.noShow eq 1>
				   <cfset request.noShow = 0>
				 <cfelse>
				   <td<cfif cellAlign gt ''> align="#cellalign#"</cfif>>#request.fValue#</td>
				 </cfif>
		 </cfloop>
		 </tr>	 
	 </cfloop>
	 </table>
</cffunction>

<cffunction name="authMenu" output="true" returntype="boolean">
	<cfif request.user.loggedIn>
		<cfif request.user.authModules.recordcount gt 0>
			<cfreturn true>
		</cfif>
	</cfif>  <!--- if request.user.loggedIn --->
	<cfreturn false>
</cffunction>

<cffunction name="loginTable" output=True>
   <TD valign="top">
   <table cellpadding="0" cellspacing="0" width="155" background="/Images/sideMenu/cart_bg_shadow.gif">
   <tr><td  height="102" background="/Images/sideMenu/admin_quiksearch_bg.gif" valign="bottom" align="right">
    <a href="##" onclick="javascript:window.open('/NavTips.cfm','NavTips','scrollbars=1,toolbar=0,location=0,directories=0,width=400');" class="TopNav" title="Navigation Tips">Navigation Tips</a>&nbsp;</td></tr>
	  
	  <!--- <tr><Td><a href="##" onClick="javascript:window.open('/myceinfo.cfm','MyCEinfo','scrollbars=1,toolbar=0,location=0,directories=0,width=320');" title="Register Online Instructions"><img src="/cesprung/Images/sideMenu/admin_myce_bg.gif" border="0"></a></Td>
	  </tr>
	  <cfif listLen(request.user.selectedCourses) gt 0>
		<tr> 
		  <td height="19">&nbsp;&nbsp;<strong>
		  <a href="/cesprung/CourseIndex/selected.cfm" class="rsNav">
		  <font face="Arial, Helvetica, sans-serif" size ="2" color="990000"><strong>View Details
		  </strong></font></a> </td>
		</tr>
		<cfif request.user.selectedCourses gt ''>
			<cfquery name="getSelCourses" datasource="#request.dsource#">
			  SELECT * FROM section LEFT JOIN course ON section.courseID = course.courseID
			  WHERE sectionID IN (#request.user.selectedCourses#)
			</cfquery>
			<cfloop query="getSelCourses">
			  <tr> 
			  <td>&nbsp;&nbsp; 
<a href="/infobase/?m=#courseID#" class="rsNav">
<font face="Arial, Helvetica, sans-serif" size ="1" color="000000">
#left(name,25)#</font></a></td>
			  </tr>
			</cfloop>
		<cfelse>
		 <tr><td height="5"></td></tr>
		</cfif>
	    <tr>
	    <td>&nbsp;&nbsp; <strong> <a href="/cesprung/LLMS/signin.cfm" class="rsNav">
		<font face="Arial, Helvetica, sans-serif" size ="2" color="990000"><strong>Go
		to	Registration</strong></font></a></td>
	    </tr>
	 </cfif>		
	 <tr><td><img src="/cesprung/Images/sideMenu/admin_verisign.gif"></td></tr> --->
<cfif request.user.loggedIn>
<style>
a.rsNav:active {  font-family: Arial, Helvetica, sans-serif; color: ##990000; text-decoration: underline; font-size: 12px; background-color: white}
a.rsNav:link {  font-family: Arial, Helvetica, sans-serif; color: ##990000; text-decoration: none; font-size: 12px; background-color: white}
a.rsNav:visited {  font-family: Arial, Helvetica, sans-serif; color: ##990000; text-decoration: none; font-size: 12px; background-color: white}
a.rsNav:visited:hover {  font-family: Arial, Helvetica, sans-serif; color: ##990000; text-decoration: none; font-size: 12px; background-color: white}
a.rsNav:hover {
	font-family: Arial, Helvetica, sans-serif;
	color: ##990000;
	text-decoration: underline;
	font-size: 12px;
	background-color: white
}
</style>
   <table cellpadding="0" cellspacing="0" width="155" background="/Images/sideMenu/cart_bg_shadow.gif">
      <cfif authMenu()><cfelse>ERROR getting menu authorization!<cfabort></cfif>
			  <cfquery name="getModules" dbtype="query">
           SELECT * FROM authModules WHERE  
			  <cfif request.user.curModuleID eq 0>
			    parentID is NULL ORDER BY moduleName
			  <cfelse>
			    moduleID = <cfif request.user.curParentID gt ''>#request.user.curParentID#<cfelse>#request.user.curModuleID#</cfif>
			  </cfif>              
			  </cfquery>
			  <cfif request.user.curModuleID neq 0>
			   <tr><td>&nbsp;</td><td><br><strong><a href="/infobase/?m=0" class="rsNav">Main Menu</a></strong>
			   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/infobase/?logout=yes" class="rsNav">Log Out</a></Td></tr>		
			  </cfif>
			   <tr><td colspan="2"><br></Td></tr>		
			  <cfloop query="getModules"> 
                <tr> 
                  <td>&nbsp;</td>
				  <td align="left">
				   <strong>&nbsp;<a href="/infobase/?m=#moduleID#" class="rsNav">#moduleName#</a></strong></td>
                </tr>
                <cfif request.user.curModuleID neq 0>
					<cfquery name="getSubModules" dbtype="query">
					SELECT * FROM authModules WHERE parentID = #getModules.moduleID#
					ORDER BY moduleName 
					</cfquery>
					<cfloop query="getSubModules">
					  <tr> 
	                    <td>&nbsp;</td>
						<td> &nbsp; <a href="/infobase/#moduleLink#" class="rsNav" >#moduleName#</a></td>
					  </tr>
					</cfloop>
				<cfelse>
				  <tr><td colspan="2" height="10"></td></tr>
				</cfif>
              </cfloop> 
	   </table>	
</cfif>
	   </TD>
</cffunction>

<cffunction name="Yahoo_cache" output="false" returntype="query">
	<cfargument name="seg" required="true" type="string">
	<cfargument name="rowCount" default="10">
  <cfquery name="delOldStories" datasource="#request.dsource#">
	  DELETE FROM yahoorss WHERE segment = "#seg#"
	</cfquery>
	<cfset rssfeed="http://rss.news.yahoo.com/rss/#seg#">
	<cfhttp url="http://rss.news.yahoo.com/rss/#seg#" method="get" />
	<cfset objRSS = xmlParse(cfhttp.filecontent)>
	<cfset newslength = arrayLen(objRSS.rss.channel.item)>	
	<cfloop index=i from=1 to=#rowCount#>
		<cfquery name="addItem" datasource="#request.dsource#">
		  INSERT INTO yahoorss (segment,itemlink,itemtext,itemtitle,adddate)
			VALUES ('#seg#','#objRSS.rss.channel.item[i].link.xmltext#','#objRSS.rss.channel.item[i].description.xmltext#',
			        '#objRSS.rss.channel.item[i].title.xmltext#',#createODBCdateTime(now())#)
		</cfquery>
	</cfloop>	
	<cfquery name="getYahooRSS" datasource="#request.dsource#">
		SELECT * FROM yahoorss WHERE segment = "#seg#"
	</cfquery>
	<cfreturn getYahooRSS>	
</cffunction>

<cffunction name="Yahoo_RSS" output="true">
  <cfargument name="segments" default="topstories" required="yes">
	<cfargument name="rowCount" default="10">
	<CFOUTPUT><img src="/Images/yahooNews.gif" align="top"></CFOUTPUT>
	<cftry>
	<cfset segmentlist="topstories,world, business,tech,politics,sports,entertainment,health,oddlyenough,science,oped,mostemailed,highestrated,mostviewed">
	<cfset segmenttitles="Top Stories,World, Business, Technology, Politics, Sports, Entertainment, Health, Oddly Enough, Science, Editorials, Most Emailed, Highest Rated, Most Viewed">
	<cfloop list="#segments#" index="seg">
		<cfset segmentnumber=#listFind(segmentlist,"#seg#")#>
		<cfset segmenttitle=#listGetAt(segmenttitles,segmentnumber)#>
		<cfquery name="getYahooRSS" datasource="#request.dsource#">
		  SELECT * FROM yahoorss WHERE segment = "#seg#"
		</cfquery>
		<cfif getYahooRSS.recordcount eq 0 OR datediff('n',getYahooRSS.adddate,now()) gt 10>
		  <cfset getYahooRSS = Yahoo_cache(seg,rowCount)>
		</cfif>
		<h3 style="text-weight:bold;">#segmenttitle#</h3>
		<cfloop query="getYahooRSS">
				<cfset itemtextx = rereplace(itemtext,"</?\w+(((\s|\n)+\w+((\s|\n)*=(\s|\n)*(?:"".*?""|'.*?'|[^'"">\s]+))?)+(\s|\n)*|(\s|\n)*)/?>","","all")>
				<cfoutput>
					&nbsp; <a href="#itemlink#" title="#itemtextx#" target="_blank">#itemtitle#</a><br>
					<!--- #rereplace(itemtext,"</a>(.*?)<br[^>]*>","",'all')##itemtitle#</a><br> --->
				</cfoutput>
		</cfloop>
	</cfloop>
	<cfcatch>
	  <h3>Yahoo Unreachable</h3>
	  #cfcatch.Message#
	</cfcatch>
	</cftry>
</cffunction>

<cffunction name="navBar" output=True>
<cfif request.user.loggedIn>
<div id="navBar"> 
  <div id="search"> 
    <form action="/infobase/Courses/view/index.cfm" method="post"> 
      <label>Find</label>
      <input name="keyword" type="text" size="10"> 
      <input name="goButton" type="submit" value="go"> 
    </form> 
  </div> 
	<span style="font-size:10px"> <a href="/infobase/changeSem.cfm">#request.user.semesterName# Semester</a></span>
      <cfif authMenu()><cfelse><a href="/infobase/?logout=yes">Log Out</a><br>ERROR getting menu authorization!<cfabort></cfif>
			  <cfset authModules = request.user.authModules>
			  <cfquery name="getModules" dbtype="query">
           SELECT * FROM authModules WHERE  
			  <cfif request.user.curModuleID eq 0>
			    parentID is NULL ORDER BY moduleName
			  <cfelse>
			    moduleID = <cfif request.user.curParentID gt ''>#request.user.curParentID#<cfelse>#request.user.curModuleID#</cfif>
			  </cfif>              
			  </cfquery>
				<table cellpadding="0" cellspacing="0" width="160">
				<tr><td>
				<cfif request.user.curModuleID neq 0>
			   <a href="/infobase/?m=0"><h4>Main Menu</h4></a>
			  </cfif></td>
				<td align="right"> <a href="/infobase/?logout=yes">Log Out</a></td></tr>
				</table>
				<div id="sectionLinks"> 
					<ul> 
			  <cfloop query="getModules"> 
          <li><a href="/infobase/?m=#moduleID#">#moduleName#</a></li>
        <cfif request.user.curModuleID neq 0>
					<cfquery name="getSubModules" dbtype="query">
					SELECT * FROM authModules WHERE parentID = #getModules.moduleID#
					ORDER BY moduleName 
					</cfquery>
					<cfloop query="getSubModules">
					  <li<cfif ucase(listLast(moduleLink,'/\\')) eq ucase(listGetAt(cgi.PATH_TRANSLATED,listLen(cgi.PATH_TRANSLATED,'/\\')-1,'/\\'))> style="font-style:italic"</cfif>><a href="/infobase/#moduleLink#">&nbsp; #moduleName#</a></li>
					</cfloop>
				<cfelse>
				</cfif>
        </cfloop> 
    </ul> 
  </div> 
<cfquery name="checkMail" datasource="#request.dsource#">
  SELECT * FROM messages WHERE FIND_IN_SET(#request.user.personID#,toPeopleIDs)
	AND messageID NOT IN (select messageID from messagesread WHERE personID = #request.user.personID#)
</cfquery>
  <div class="relatedLinks"> 
    <h3>My Stuff</h3> 
    <ul> 
      <li><a href="/infobase/User/messages.cfm">Messages
			<cfif checkMail.recordcount gt 0><b style="font-size:10px;">(#checkMail.recordcount# New)</b></cfif>
			</a></li> 
      <li><a href="##">Preferences</a></li> 
    </ul> 
  </div> 
<!---   <div id="advert"> 
    <img src="/infobase/clipart/unmsmall.gif" alt="UNM"> University of New Mexico
  </div> 
 --->
   <div id="headlines"> 
		#Yahoo_RSS(segments='topstories,tech',rowCount='3')#
  </div> 
</div> 
</cfif>
<!--end navbar --> 
</cffunction>



<cffunction name="phoneFormat" returntype="string" output="false">
  <cfargument name="daPhoneNum" required="true" hint="number is required">
  <cfset daPhoneNum = rereplace(daPhoneNum,"\(|\)| |-",'',"all")>
	<cfif len(daPhoneNum) gt 7>
	 <cfset daPhoneNum = '(#left(daPhoneNum,3)#) #mid(daPhoneNum,4,3)#-#right(daPhoneNum,4)#'>  
	<cfelseif len(daPhoneNum) eq 7>
	 <cfset daPhoneNum = '(505) #left(daPhoneNum,3)#-#right(daPhoneNum,4)#'>  	
	<cfelse>
	 <cfset daPhoneNum = '(505) '>	
	</cfif>
 <cfreturn daPhoneNum>
</cffunction>

<cffunction name="linkConfirm" output="false">
	<cfargument name="message" type="string" required="true">
	<cfargument name="jscript" type="string" default="">
	<cfif jscript gt "">
		<cfreturn "onclick='if (confirm (""#message#"")) {#jscript#} else {return false}'">
	<cfelse>
		<cfreturn "onclick='if (confirm (""#message#"")) {return true} else {return false}'">
	</cfif>
</cffunction>

<cffunction name="setFormQry" output="false" returntype="boolean">
 <cfargument name="daQry" hint="query is needed" type="query" required="true">
   <cfloop list="#daQry.columnlist#" index="dc">
    <cfset "request.#dc#" = "#evaluate('daQry.'&dc)#">
   </cfloop>
   <cfreturn true>
</cffunction>

<cffunction name="denSaveForm" output="false" returntype="string">
  <cfargument name="daTable" hint="table name needed" type="string" required="true">
  <cfargument name="daDS" hint="table name needed" type="string" default="#request.dsource#">
  <!--- <cfset daTable = lcase(daTable)> --->
	 <!--- <cftry> --->
	<cfquery name="daTableLayout" datasource="#daDS#">
	  describe #daTable#
	</cfquery>
	<cfquery name="daPK" datasource="#daDS#">
	  SHOW INDEX FROM #daTable#
	</cfquery>
	<cfquery name="getPriKey" dbtype="query" maxrows="1">
	  SELECT Column_name as field
	  FROM daPK
	  WHERE Key_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="PRIMARY">
	</cfquery>
  <cfif getPriKey.field gt ''>
	 <cfset request.PriKey = getPriKey.field>
	<cfelse>
	 <cfset request.PriKey = "somefielddood">
	 <cfset form.somefielddood = 0>
	</cfif>	
  <cfif NOT isDefined('form.#request.PriKey#')>
		<cfset "form.#request.PriKey#" = 0>	
	</cfif>
	<cfif structKeyExists(form,getPriKey.field) AND listLen(form[getPriKey.field]) gt 1>
	  <cfset request.multiRecs = true>
  <cfelse>
	  <cfset request.multiRecs = false>
	</cfif>
	<cflock scope="session" type="exclusive" timeout="10">
		<cfset session.daCOunt =listLen(form[request.PriKey])>
		<cfset session.daCOunt = session.daCOunt>
	</cflock> 
	<cfset request.curRec = 0>
	<cfloop list="#form[request.PriKey]#" index="recID">
	  <cfset request.curRec = request.curRec + 1>
	  <cfif request.multiRecs><cfset request.cr = '_#recID#'><cfelse><cfset request.cr = ''></cfif>
		<cfset request.dFlist = ''>
		<cfset request.dTlist = ''>
		<cfset request.dFFlist = ''>
		<cfloop query="daTableLayout">
		 <cfif isDefined('form.'&field&request.cr) AND 'form.'&field&request.cr neq 'form.'&request.PriKey&request.cr>
			<cfset request.dFlist = listAppend(request.dFlist,field)>
			<cfset request.dFFlist = listAppend(request.dFFlist,field&request.cr)>
			<cfset request.dTlist = listAppend(request.dTlist,type)>
		 </cfif>
		</cfloop>
		<cfif NOT isDefined('form.#request.PriKey#') OR recID eq 0>
			<cfquery name="addRec" datasource="#daDS#">
			INSERT INTO #daTable#
			 (
			 <cfif listfindNoCase(valueList(daTableLayout.field),'createDate')>createDate,</cfif>
			 <cfif listfindNoCase(valueList(daTableLayout.field),'modDate')>modDate,</cfif>
			 <cfif listfindNoCase(valueList(daTableLayout.field),'userID') AND NOT isDefined('form.userID')>userID,</cfif>
			 <cfif listfindNoCase(valueList(daTableLayout.field),'modUserID') AND isDefined('request.user.userID')>modUserID,</cfif>
			 <cfloop list="#request.dFlist#" index="ff">#daTable#.#ff#<cfif ff neq listlast(request.dFList)>,</cfif></cfloop>) 
			 VALUES (
				 <cfif listfindNoCase(valueList(daTableLayout.field),'createDate')>#createODBCdateTime(now())#,</cfif>
				 <cfif listfindNoCase(valueList(daTableLayout.field),'modDate')>#createODBCdateTime(now())#,</cfif>
				 <cfif listfindNoCase(valueList(daTableLayout.field),'userID') AND NOT isDefined('form.userID')>#request.user.userID#,</cfif>
				 <cfif listfindNoCase(valueList(daTableLayout.field),'modUserID') AND isDefined('request.user.userID')>#request.user.userID#,</cfif>
			  <cfloop list="#request.dFFlist#" index="ff">
					<cfif listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'datetime' AND isDate(form[ff])
					 OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'smalldatetime' AND isDate(form[ff])
					 OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'date' AND isDate(form[ff])>
					 #createODBCdateTime(listGetAt(form[ff],request.curRec))#
					<cfelseif listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'real' AND LSisNumeric(evaluate('form.'&ff))>
					 <cfqueryparam cfsqltype="cf_sql_real" value="#rereplace(form[ff],',','','all')#">
					<cfelseif listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'double' AND LSisNumeric(evaluate('form.'&ff))>
					 <cfqueryparam cfsqltype="cf_sql_double" value="#rereplace(form[ff],',','','all')#">
					<cfelseif  listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'numeric' AND LSisNumeric(evaluate('form.'&ff))
					 OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'int' AND LSisNumeric(evaluate('form.'&ff))>
					 <cfqueryparam cfsqltype="cf_sql_numeric" value="#rereplace(form[ff],',','','all')#">
					<cfelseif findNoCase('text',listGetAt(request.dTlist,listFind(request.dFFlist,ff))) AND form[ff] gt ''>
						<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form[ff]#">
					<cfelse>
						<cfif form[ff] gt ''>
							<cfqueryparam cfsqltype="cf_sql_varchar" value="#form[ff]#">
						<cfelse>
							NULL
						</cfif>
				</cfif>
				 <cfif ff neq listlast(request.dFFlist)>,</cfif>
				</cfloop>)
			</cfquery>
			<cfquery name="getReturnID" datasource="#daDS#" >
				SELECT LAST_INSERT_ID() as returnID
			</cfquery>
			<cfset request.lastInsertID = getReturnID.returnID>
		 <cfelse>
			 <cfquery name="updateRec" datasource="#daDS#">
				 UPDATE #daTable#
					SET <cfif listfindNoCase(valueList(daTableLayout.field),'modUserID') AND isDefined('request.user.userID')>
				 modUserID = #request.user.userID#, modDate = #createODBCdateTime(now())#<cfif listLen(request.dFlist) gt 0>,</cfif></cfif> 
				 <cfloop list="#request.dFFlist#" index="ff">
				 #daTable#.#listGetAt(request.dFlist,listFind(request.dFFlist,ff))# = 
					<cfif listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'datetime' AND isDate(form[ff])
					 OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'smalldatetime' AND isDate(form[ff])
					 OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'date' AND isDate(form[ff])>
					 #createODBCdateTime(listGetAt(form[ff],request.curRec))#
					<cfelseif  listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'numeric' AND LSisNumeric(form[ff])
					OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'int' AND LSisNumeric(form[ff])
					OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'real' AND LSisNumeric(form[ff])
					OR listGetAt(request.dTlist,listFind(request.dFFlist,ff)) eq 'double' AND LSisNumeric(form[ff])>
					 <cfqueryparam cfsqltype="cf_sql_numeric" value="#rereplace(form[ff],',','','all')#">
					<cfelseif findNoCase('text',listGetAt(request.dTlist,listFind(request.dFFlist,ff))) AND form[ff] gt ''>
						<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form[ff]#">
					<cfelse>
						<cfif form[ff] gt ''>
							<cfqueryparam cfsqltype="cf_sql_varchar" value="#form[ff]#">
						<cfelse>
							NULL
						</cfif>
				 </cfif>
				 <cfif ff neq listlast(request.dFFList)>,</cfif>
				 </cfloop>
				WHERE #request.PriKey# = #recID#
			 </cfquery>
			 <cfset request.lastInsertID = recID>
		 </cfif>
  </cfloop>	 	 
	<cfreturn request.lastInsertID>
<!---    <cfcatch type="database">
      <cfreturn "<BR>An error has occured! Please check the data!
	  <UL>
	  <LI><b>Type:</b>#CFCATCH.Type#
	  <LI><b>Message:</b>#CFCATCH.Message#
	  <LI><b>Detail:</b>#CFCATCH.Detail#
	  <LI><b>Native Error Code:</b>#CFCATCH.NativeErrorCode#
	  <LI><b>Error Code:</b>#CFCATCH.ErrorCode#
	  <LI><b>SQL State:</b>#CFCATCH.SQLState#
	  </ul>"><cfabort>
   </cfcatch>
   </cftry> --->
</cffunction>


<cffunction name="denFormat" output="false">
 <cfargument name="daText" required="true" type="string" hint="Needs some text to format">
 <cfset daText = reReplace(daText,chr(9),'&nbsp;&nbsp;&nbsp;&nbsp;','ALL')>
 <cfset daText = reReplace(daText,Chr(13)&Chr(10),'<br>&nbsp;&nbsp;&nbsp;&nbsp;','ALL')>
 <cfset daText = reReplace(daText,Chr(13),'<br>&nbsp;&nbsp;&nbsp;&nbsp;','ALL')>
 <cfset daText = reReplace(daText,Chr(10),'<br>&nbsp;&nbsp;&nbsp;&nbsp;','ALL')>
 <cfreturn daText>
</cffunction>

<cffunction name="listConflict" output="true">
  <cfargument name="personORroom" required="yes" default="string">
  <cfargument name="checkThisID" required="yes" default="numeric">
  <cfargument name="startDT" required="yes" default="date">
  <cfargument name="endDT" required="yes" default="date">
  <cfargument name="exclude" required="no" default="string">
  <cfargument name="displayType" required="no" default="0">
	<cfif Minute(startDT) gt 0>
	 <cfset request.ckMin = (Minute(startDT)-1)>
	 <cfset request.ckHr = timeFormat(startDT,'HH')>
	<cfelse>
	 <cfset request.ckMin = '59'>
	 <cfset request.ckHr = (timeFormat(startDT,'HH')-1)>
	</cfif>
	<cfset request.ckStartDate = createODBCdateTime('#dateformat(endDT,'yyyy-mm-dd')# #request.ckHr#:#request.ckMin#:00')>
	<cfif Minute(endDT) lt 59>
	 <cfset request.ckMin = (Minute(endDT)+1)>
	 <cfset request.ckHr = timeFormat(endDT,'HH')>
	<cfelse>
	 <cfset request.ckMin = Minute(endDT)>
	 <cfset request.ckHr = (timeFormat(endDT,'HH')+1)>
	</cfif>
	<cfset request.ckEndDate = createODBCdateTime('#dateformat(startDT,'yyyy-mm-dd')# #request.ckHr#:#request.ckMin#:00')>
	<cfif personORroom eq 'person'>	 
	 <cfquery name="checkConflict" datasource="#request.dsource#">
		 SELECT sectionSchedules.*, sectionInstructors.personID, course.courseID, concat(course.coursenumber,' ',course.name) as coursename, section.sectionName
		 FROM sectionSchedules INNER JOIN sectionInstructors ON sectionSchedules.sectionID = sectionInstructors.sectionID
				INNER JOIN section ON sectionSchedules.sectionID = section.sectionID
						INNER JOIN course ON section.courseID = course.courseID
		 WHERE sectionSchedules.personID = '#checkThisID#'
		 AND section.sectionStatus != 'Cancelled' AND sectionSchedules.personID != 692
		 <cfif exclude gt ''>AND sectionSchedules.sectionID NOT IN (#exclude#)</cfif>
		 AND sectionSchedules.startDateTime BETWEEN #request.ckStartDate# AND #request.ckEndDate#
		 OR sectionSchedules.personID = '#checkThisID#'
		 AND section.sectionStatus != 'Cancelled' AND sectionSchedules.personID != 692
		 <cfif exclude gt ''>AND sectionSchedules.sectionID NOT IN (#exclude#)</cfif>
		 AND sectionSchedules.endDateTime BETWEEN #request.ckStartDate# AND #request.ckEndDate#
	 </cfquery>
  <cfelseif personORroom eq 'room'>
	 <cfquery name="checkConflict" datasource="#request.dsource#">
		 SELECT sectionSchedules.*, sectionClassrooms.classroomID, course.courseID, concat(course.coursenumber,' ',course.name) as coursename,section.sectionName
		 FROM sectionSchedules INNER JOIN sectionClassrooms ON sectionSchedules.sectionID = sectionClassrooms.sectionID
				INNER JOIN section ON sectionSchedules.sectionID = section.sectionID
						INNER JOIN course ON section.courseID = course.courseID
		 WHERE sectionSchedules.classroomID = '#checkThisID#'
			 AND section.sectionStatus != 'Cancelled'
		 <cfif exclude gt ''>AND sectionSchedules.sectionID NOT IN (#exclude#)</cfif>
		 AND sectionSchedules.startDateTime BETWEEN #request.ckStartDate# AND #request.ckEndDate#						 
		 OR sectionSchedules.classroomID = '#checkThisID#'
		 <cfif exclude gt ''>AND sectionSchedules.sectionID NOT IN (#exclude#)</cfif>
		 AND section.sectionStatus != 'Cancelled'
		 AND sectionSchedules.endDateTime BETWEEN #request.ckStartDate# AND #request.ckEndDate#						 
	 </cfquery>	
  </cfif>
	<cfset request.conflict = false>
	<cfif checkConflict.recordcount gt 0>
	<cfif personORroom eq 'room' AND displayType eq 1>
    <cfset conflictType = 'Room Conflict'>	  
	<cfelseif personORroom eq 'person' AND displayType eq 1>
    <cfset conflictType = 'Person Conflict'>	  
	<cfelse>
    <cfset conflictType = 'Conflict'>	  
	</cfif>
		<cfloop query="checkConflict">
		<cfset request.conflict = true>
			<cfif NOT listFind(request.alreadyOutput,secSchedID)>
				<cfif sectionID neq request.revExclude>
				  <cfif request.origSecID neq sectionID AND request.origSecID neq excludeIs.sectionID>
					  <!--- These are conflicts but not for the specific thing we're checking --->
					<cfelse>
						<font color="red" size="-2">#conflictType#</font> <font size="-1"><a href="/infobase/Courses/Sections/?sectionID=#checkConflict.sectionID#&courseID=#courseID#">#coursename# #sectionName#</a></font>
						<font size="-2"> #dateformat(startDateTime,'m/dd/yy')# #timeformat(startDateTime,'h:mmtt')#-#timeformat(endDateTime,'h:mmtt')#</font>			
						<br>
					</cfif>
					<cfset request.alreadyOutput = listAppend(request.alreadyOutput,secSchedID)>
				<cfelse>
				  <cfif request.origSecID neq sectionID AND request.origSecID neq excludeIs.sectionID>
					  <!--- These are conflicts but not for the specific thing we're checking --->
					<cfelse>
						<font color="red" size="-2">#conflictType#</font> <font size="-1"><a href="/infobase/Courses/Sections/?sectionID=#excludeIs.sectionID#&courseID=#excludeIs.courseID#">#excludeIs.coursename# #excludeIs.sectionName#</a></font>
						<font size="-2"> #dateformat(excludeIs.startDateTime,'m/dd/yy')# #timeformat(excludeIs.startDateTime,'h:mmtt')#-#timeformat(excludeIs.endDateTime,'h:mmtt')#</font>			
						<br>
					</cfif>
					<cfset request.alreadyOutput = listAppend(request.alreadyOutput,excludeIs.secSchedID)>
			  </cfif>
      </cfif>
		</cfloop>
	</cfif>
</cffunction> 

<cffunction name="listConflicts" output="true">
  <cfargument name="personORroom" required="yes" default="string">
  <cfargument name="checkThisID" required="yes" default="numeric">
  <cfargument name="startDT" required="yes" default="date">
  <cfargument name="endDT" required="yes" default="date">
  <cfargument name="exclude" required="no" default="string">
  <cfargument name="displayType" required="no" default="0">
	<cfif datediff("m",startDT,endDT) gt 6>
	  Longer than 6 Months, aborting!
	<cfelse>
		<cfset request.origSecID = exclude>
		<cfset request.revExclude = exclude>
		<cfset request.alreadyOutput = ''>
		<cfif checkThisID gt ''>
			<cfif personORroom eq 'person'>
				<cfquery name="getAllDay" datasource="#request.dsource#">
					 SELECT sectionSchedules.*, sectionSchedules.personID, course.courseID, concat(course.coursenumber,' ',course.name) as coursename, section.sectionName
					 FROM sectionSchedules LEFT JOIN section ON sectionSchedules.sectionID = section.sectionID
									INNER JOIN course ON section.courseID = course.courseID
					 WHERE sectionSchedules.personID = '#checkThisID#' AND section.sectionStatus != 'Cancelled'
						 AND left(sectionSchedules.startDateTime,10) = '#dateformat(startDT,'yyyy-mm-dd')#' 
				</cfquery>
			<cfelseif personORroom eq 'room'>
				<cfquery name="getAllDay" datasource="#request.dsource#">
					 SELECT sectionSchedules.*, sectionSchedules.classroomID, course.courseID, concat(course.coursenumber,' ',course.name) as coursename, section.sectionName
					 FROM sectionSchedules INNER JOIN section ON sectionSchedules.sectionID = section.sectionID
									INNER JOIN course ON section.courseID = course.courseID
					 WHERE sectionSchedules.classroomID = '#checkThisID#' AND section.sectionStatus != 'Cancelled'
						 AND left(sectionSchedules.startDateTime,10) = '#dateformat(startDT,'yyyy-mm-dd')#'
				</cfquery>
			</cfif>
			<cfloop query="getAllDay">
				<cfloop list="#getAllDay.columnlist#" index="cl">
					<cfset excludeIs['#cl#'] = evaluate('getAllDay.'&cl)>		
				</cfloop>
				 #listConflict(personORroom,checkThisID,startDateTime,endDateTime,sectionID,displayType)#
			</cfloop>
		</cfif>
	</cfif>
</cffunction> 

<cffunction name="pageHistory" output="true">
  <cfargument name="width" default="100%">
	<cfargument name="height" default="400">
  <cfif isDefined('form.pagehistoryID')>
	  <cfset form.script_name = cgi.SCRIPT_NAME>
	  <cfset request.pagehistoryID = denSaveForm('pagehistory',request.dsource)>
	</cfif>
  <cfquery name="getPageHistory" datasource="#request.dsource#">
	  SELECT * FROM pagehistory WHERE script_name = <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#cgi.SCRIPT_NAME#">
		<cfif isDefined('url.pagehistoryID')>AND pagehistoryID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.pagehistoryID#"></cfif>
		ORDER BY createDate DESC
	</cfquery>
	<cfif listFind(request.user.groupIDs,1)>
	  <a href="#cgi.SCRIPT_NAME#?pagehistoryID=#getPageHistory.pagehistoryID#">Edit</a>
	  <a href="#cgi.SCRIPT_NAME#?pageHistoryID=0">New</a>
	  <cfif isDefined('url.pagehistoryID')>
		  <cfform action="#cgi.SCRIPT_NAME#" method="post">
			  <input type="hidden" name="pagehistoryID" value="#val(getPageHistory.pagehistoryID)#">
				<cfscript>
					fckEditor = createObject("component", "/FCKeditor/fckeditor");
					fckEditor.instanceName	= "pageText";
					fckEditor.value			= '#getPageHistory.pageText#';
					fckEditor.basePath		= "/FCKeditor/";
					fckEditor.width			= "#width#";
					fckEditor.height		= #height#;
					//fckEditor.config["Debug"] = true;
					fckEditor.config["LinkBrowser"] = true ;
					fckEditor.config["ImageBrowser"] = true ;
					fckEditor.config["LinkBrowserURL"] = fckEditor["basePath"] & 'editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php' ;
					fckEditor.config["ImageBrowserURL"] = fckEditor["basePath"] & 'editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php' ;
					//fckEditor.config["LinkBrowserURL"] = fckEditor["basePath"] & 'editor/filemanager/browser/fbxp/browser.html?Connector=connectors/php/connector.php' ;
					//fckEditor.config["ImageBrowserURL"] = fckEditor["basePath"] & 'editor/filemanager/browser/fbxp/browser.html?Type=Image&Connector=connectors/php/connector.php' ;
					fckEditor.config["SkinPath"] = fckEditor["basePath"] & 'editor/skins/office2003/' ;
					fckEditor.config["CustomConfigurationsPath"] = '/FCKeditor/customConfig.cfm';
					fckEditor.config["FontNames"]	= 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana;' ;
					fckEditor.toolBarSet = 'PageHistory';
					fckEditor.config["ToolbarCanCollapse"] = false;
					fckEditor.create(); // create the editor.
				</cfscript>						
			</cfform>
		
		<cfelse>
			#getPageHistory.pageText#
		</cfif>
	<cfelse>
	 #getPageHistory.pageText#
	</cfif>
</cffunction>

<cffunction name="jscalendar" output="true">
  <cfargument name="inputFields" required="yes" type="string">
  <cfargument name="ifFormat" default="%m/%d/%Y" type="string">

	<cfhtmlhead text='<style type="text/css">@import url(/include/jscalendar/calendar-win2k-1.css);</style>
	<script type="text/javascript" src="/include/jscalendar/calendar.js"></script>
	<script type="text/javascript" src="/include/jscalendar/lang/calendar-en.js"></script>
	<script type="text/javascript" src="/include/jscalendar/calendar-setup.js"></script>'>
	<script type="text/javascript">
    <cfloop list="#inputFields#" index="infld">
		Calendar.setup(
			{
				inputField  : "#listFirst(infld,':')#",         // ID of the input field
				ifFormat    : "#ifFormat#",    // the date format
				button      : "#listLast(infld,':')#"
			}
		);
		</cfloop>
	</script>

</cffunction>